import type { Ref } from 'vue'

export class AnimationManager {
  private static instance: AnimationManager
  private animations: Map<string, any> = new Map()

  private constructor() {}

  public static getInstance(): AnimationManager {
    if (!AnimationManager.instance) {
      AnimationManager.instance = new AnimationManager()
    }
    return AnimationManager.instance
  }

  public registerAnimation(key: string, animation: any) {
    this.animations.set(key, animation)
  }

  public getAnimation(key: string) {
    return this.animations.get(key)
  }

  public playAnimation(key: string) {
    const animation = this.animations.get(key)
    if (animation && animation.value) {
      animation.value.play()
    }
  }
}

export const animationManager = AnimationManager.getInstance() 